package com.zsy.petshop_01.controller;

import com.zsy.petshop_01.common.result.ResponseResult;
import com.zsy.petshop_01.model.vo.vip.PublishVideoVo;
import com.zsy.petshop_01.model.vo.vip.UpdateVideoVo;
import com.zsy.petshop_01.service.VIPService;
import com.zsy.petshop_01.service.impl.MinIOService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@Api(tags = "会员消息管理")
@RestController
@RequestMapping("/vip")
public class VIPController {
    @Autowired
    VIPService vipService;
    @Autowired
    MinIOService minIOService;

    @ApiOperation("搜索所有会员发送的信息")
    @GetMapping("/selectAll")
    public ResponseResult<?> selectAll() {
        return vipService.selectAll();
    }

    @ApiOperation("搜索某个会员发送的信息")
    @GetMapping("/selectByUserName")
    public ResponseResult<?> selectByUserName(@RequestParam(value = "userName", required = false) String userName) {
        return vipService.selectByUserName(userName);
    }

    @ApiOperation("发布会员信息")
    @PostMapping("/publish")
    public ResponseResult<?> publish(@RequestParam("message") String message, HttpServletRequest request) {
        return vipService.publish(message, request);
    }

    @ApiOperation("删除发布的信息")
    @PostMapping("/delete")
    public ResponseResult<?> delete(@RequestParam("id") Integer id) {
        return vipService.delete(id);
    }

    @ApiOperation("查看监控")
    @GetMapping("/watchMonitoring")
    public ResponseResult<?> watchMonitoring() {
        return vipService.watchMonitoring();
    }

    @ApiOperation("发布视频")
    @PostMapping("/publishVideo")
    public ResponseResult<?> publishVideo(PublishVideoVo publishVideoVo) {
        return vipService.publishVideo(publishVideoVo);
    }

    @ApiOperation("修改视频")
    @PostMapping("/updateVideo")
    public ResponseResult<?> updateVideo(@RequestBody UpdateVideoVo updateVideoVo) {
        return vipService.updateVideo(updateVideoVo);
    }

    @ApiOperation("删除视频")
    @PostMapping("/deleteVideo")
    public ResponseResult<?> deleteVideo(@RequestParam("id") Integer id) {
        return vipService.deleteVideo(id);
    }

    @ApiOperation("搜索所有的视频")
    @GetMapping("/selectAllVideo")
    public ResponseResult<?> selectAllVideo() {
        return vipService.selectAllVideo();
    }
}
